package com.unionfetch.content_home.bean

enum class UserStatus(val status: Int) {
    /**
     * 客户端自己定义的状态，未知状态
     */
    UNKONWN(-1),
    TRADER_OPEN_ACCOUNT(0),
    COUNTRY_SETTING(1),
    TRADER_ACCOUNT_SETTING(2),
    TRADER_ASSESSMENT(3),
    USER_WAITTING(4),
    USER_SUCCESS(5),
    USER_FAILURE(6),
    COMPANY_INFO(100),
    COMPANY_USER_INFO(200),
    COMPANY_USER_IN_CHARGE_INFO(300)
}

/**
 * 通过status数值寻找UserStatus枚举
 */
fun Int.findUserStatus(): UserStatus {
    for (userStatus in UserStatus.values()) {
        if (userStatus.status == this) {
            return userStatus
        }
    }
    return UserStatus.UNKONWN
}